package oa.database.dao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import oa.database.bean.Employee;
import oa.database.bean.Department;
import oa.database.bean.Friends;

import oa.database.dao.EmployeeDao;
import oa.database.dao.DepartmentDao;
import oa.database.dao.FriendsDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig employeeDaoConfig;
    private final DaoConfig departmentDaoConfig;
    private final DaoConfig friendsDaoConfig;

    private final EmployeeDao employeeDao;
    private final DepartmentDao departmentDao;
    private final FriendsDao friendsDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        employeeDaoConfig = daoConfigMap.get(EmployeeDao.class).clone();
        employeeDaoConfig.initIdentityScope(type);

        departmentDaoConfig = daoConfigMap.get(DepartmentDao.class).clone();
        departmentDaoConfig.initIdentityScope(type);

        friendsDaoConfig = daoConfigMap.get(FriendsDao.class).clone();
        friendsDaoConfig.initIdentityScope(type);

        employeeDao = new EmployeeDao(employeeDaoConfig, this);
        departmentDao = new DepartmentDao(departmentDaoConfig, this);
        friendsDao = new FriendsDao(friendsDaoConfig, this);

        registerDao(Employee.class, employeeDao);
        registerDao(Department.class, departmentDao);
        registerDao(Friends.class, friendsDao);
    }
    
    public void clear() {
        employeeDaoConfig.getIdentityScope().clear();
        departmentDaoConfig.getIdentityScope().clear();
        friendsDaoConfig.getIdentityScope().clear();
    }

    public EmployeeDao getEmployeeDao() {
        return employeeDao;
    }

    public DepartmentDao getDepartmentDao() {
        return departmentDao;
    }

    public FriendsDao getFriendsDao() {
        return friendsDao;
    }

}
